import md5 from 'md5'
import moment from 'dayjs'

const util = {
  setItem: function (key, value) {
    window.localStorage.removeItem(key)
    if (value instanceof Object) {
      window.localStorage.setItem(key, JSON.stringify(value))
    } else {
      window.localStorage.setItem(key, value)
    }
  },
  getItem: function (key) {
    return window.localStorage.getItem(key)
  },
  removeItem: function (key) {
    window.localStorage.removeItem(key)
  },
  md5 (value) {
    return md5(value)
  }
}
export default util
